#########################################################################;
# File-Name: read_in_data_fit_models.R #;
# Date: September 28, 2016 #;
# Author: KM #;
# Purpose: Read in anonymized data and run models #;
#########################################################################;
options(stringsAsFactors = F)
library(dplyr)
##choose which assumption--the conservative assumption file replicates the analysis in the appendix
standard <- read.csv(file = "data/data_anonymized_standard_assumption.csv")
conservative <- read.csv(file = "data/data_anonymized_conservative_assumption.csv")
##encode treatment varaible as a factor
standard$treatment = recode( standard$treat.f, "0" = "Control Group","1"= "In-Group/Low","2" = "Out-Group/Low","3" = "In-Group/High","4" = "Out-Group/High")
standard$treat.f <- as.factor(standard$treat.f)
conservative$treatment = recode( conservative$treat.f, "0" = "Control Group","1"= "In-Group/Low","2" = "Out-Group/Low","3" = "In-Group/High","4" = "Out-Group/High")
conservative$treat.f<-as.factor(conservative$treat.f)
#1 week time period
##first model is the full analysis
(wk1_rac<-summary(lm(racism.scores.post.1wk ~ treat.f + log.followers + racism.scores.pre.2mon, data = standard)))
##
## Call:
## lm(formula = racism.scores.post.1wk ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = standard)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.126 -0.303 -0.155 0.061 3.192
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.27581 0.15117 1.82 0.069 .
## treat.f1 -0.07967 0.12450 -0.64 0.523
## treat.f2 -0.01220 0.12866 -0.09 0.925
## treat.f3 -0.25930 0.12378 -2.09 0.037 *
## treat.f4 -0.07314 0.12436 -0.59 0.557
## log.followers 0.00862 0.02092 0.41 0.681
## racism.scores.pre.2mon 1.32500 0.15197 8.72 5.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.61 on 235 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.276, Adjusted R-squared: 0.257
## F-statistic: 14.9 on 6 and 235 DF, p-value: 1.94e-14
##second model looks only at the most anonymous users
(wk1_rac_anon<-summary(lm(racism.scores.post.1wk ~ treat.f + log.followers + racism.scores.pre.2mon,
data = filter(standard,anonymity>1) )))
##
## Call:
## lm(formula = racism.scores.post.1wk ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = filter(standard, anonymity >
## 1))
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.0924 -0.3414 -0.1942 0.0881 3.1321
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.3690 0.2039 1.81 0.072 .
## treat.f1 -0.1330 0.1716 -0.78 0.439
## treat.f2 -0.1373 0.1860 -0.74 0.462
## treat.f3 -0.3389 0.1685 -2.01 0.046 *
## treat.f4 -0.1334 0.1729 -0.77 0.442
## log.followers 0.0109 0.0284 0.38 0.702
## racism.scores.pre.2mon 1.2811 0.1802 7.11 4.2e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7 on 152 degrees of freedom
## Multiple R-squared: 0.291, Adjusted R-squared: 0.263
## F-statistic: 10.4 on 6 and 152 DF, p-value: 0.00000000126
##third model looks at non-anonymous users
(wk1_rac_id<-summary(lm(racism.scores.post.1wk ~ treat.f + log.followers + racism.scores.pre.2mon,
data = filter(standard,anonymity<2))))
##
## Call:
## lm(formula = racism.scores.post.1wk ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = filter(standard, anonymity <
## 2))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.6489 -0.1936 -0.0803 0.0975 1.6014
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.04164 0.19234 0.22 0.82920
## treat.f1 0.09402 0.14623 0.64 0.52219
## treat.f2 0.27758 0.14227 1.95 0.05474 .
## treat.f3 -0.04416 0.14898 -0.30 0.76772
## treat.f4 0.10284 0.14384 0.71 0.47683
## log.followers 0.00207 0.02549 0.08 0.93544
## racism.scores.pre.2mon 1.44308 0.41982 3.44 0.00096 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4 on 76 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.196, Adjusted R-squared: 0.133
## F-statistic: 3.09 on 6 and 76 DF, p-value: 0.00915
#2weeks
(wk2_rac<-summary(lm(racism.scores.post.2wk ~ treat.f+ log.followers + racism.scores.pre.2mon, data = standard)))
##
## Call:
## lm(formula = racism.scores.post.2wk ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = standard)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.0531 -0.2066 -0.1083 0.0686 1.5867
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.22747 0.09049 2.51 0.013 *
## treat.f1 -0.02502 0.07452 -0.34 0.737
## treat.f2 0.00535 0.07701 0.07 0.945
## treat.f3 -0.15944 0.07409 -2.15 0.032 *
## treat.f4 -0.00173 0.07444 -0.02 0.981
## log.followers -0.00577 0.01252 -0.46 0.645
## racism.scores.pre.2mon 0.94264 0.09097 10.36 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.37 on 235 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.345, Adjusted R-squared: 0.328
## F-statistic: 20.6 on 6 and 235 DF, p-value: <2e-16
(wk2_rac_anon<-summary(lm(racism.scores.post.2wk ~ treat.f + log.followers + racism.scores.pre.2mon,
data = filter(standard,anonymity>1))))
##
## Call:
## lm(formula = racism.scores.post.2wk ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = filter(standard, anonymity >
## 1))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.8841 -0.2152 -0.1184 0.0606 1.6025
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.24951 0.11538 2.16 0.032 *
## treat.f1 -0.04944 0.09712 -0.51 0.611
## treat.f2 -0.07795 0.10525 -0.74 0.460
## treat.f3 -0.19742 0.09537 -2.07 0.040 *
## treat.f4 -0.07963 0.09787 -0.81 0.417
## log.followers 0.00139 0.01610 0.09 0.931
## racism.scores.pre.2mon 0.87210 0.10197 8.55 1.2e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4 on 152 degrees of freedom
## Multiple R-squared: 0.365, Adjusted R-squared: 0.34
## F-statistic: 14.6 on 6 and 152 DF, p-value: 4.38e-13
(wk2_rac_id<-summary(lm(racism.scores.post.2wk ~ treat.f + log.followers + racism.scores.pre.2mon,
data = filter(standard,anonymity<2))))
##
## Call:
## lm(formula = racism.scores.post.2wk ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = filter(standard, anonymity <
## 2))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.6958 -0.1448 -0.0490 0.0793 1.0309
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.0558 0.1422 0.39 0.696
## treat.f1 0.0917 0.1081 0.85 0.399
## treat.f2 0.2025 0.1052 1.93 0.058 .
## treat.f3 -0.0238 0.1101 -0.22 0.830
## treat.f4 0.1489 0.1063 1.40 0.166
## log.followers -0.0151 0.0188 -0.80 0.427
## racism.scores.pre.2mon 1.7847 0.3103 5.75 0.00000018 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.29 on 76 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.369, Adjusted R-squared: 0.319
## F-statistic: 7.4 on 6 and 76 DF, p-value: 0.00000298
#1month
(mon1_rac<-summary(lm(racism.scores.post.1mon ~ treat.f + log.followers + racism.scores.pre.2mon, data = standard)))
##
## Call:
## lm(formula = racism.scores.post.1mon ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = standard)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.6802 -0.1596 -0.0961 0.0410 1.7991
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.16493 0.07607 2.17 0.031 *
## treat.f1 0.00962 0.06264 0.15 0.878
## treat.f2 0.00359 0.06474 0.06 0.956
## treat.f3 -0.10728 0.06228 -1.72 0.086 .
## treat.f4 0.03832 0.06258 0.61 0.541
## log.followers -0.00610 0.01053 -0.58 0.563
## racism.scores.pre.2mon 0.79542 0.07647 10.40 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.31 on 235 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.342, Adjusted R-squared: 0.325
## F-statistic: 20.4 on 6 and 235 DF, p-value: <2e-16
(mon1_rac_anon<-summary(lm(racism.scores.post.1mon ~ treat.f + log.followers + racism.scores.pre.2mon,
data = filter(standard,anonymity>1))))
##
## Call:
## lm(formula = racism.scores.post.1mon ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = filter(standard, anonymity >
## 1))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.6820 -0.1779 -0.0857 0.0429 1.7876
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.18579 0.10061 1.85 0.067 .
## treat.f1 0.01733 0.08468 0.20 0.838
## treat.f2 -0.04533 0.09177 -0.49 0.622
## treat.f3 -0.12442 0.08315 -1.50 0.137
## treat.f4 0.01134 0.08533 0.13 0.894
## log.followers -0.00491 0.01404 -0.35 0.727
## racism.scores.pre.2mon 0.78036 0.08891 8.78 3.2e-15 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.35 on 152 degrees of freedom
## Multiple R-squared: 0.366, Adjusted R-squared: 0.341
## F-statistic: 14.6 on 6 and 152 DF, p-value: 3.91e-13
(mon1_rac_id<-summary(lm(racism.scores.post.1mon ~ treat.f + log.followers + racism.scores.pre.2mon,
data = filter(standard,anonymity<2))))
##
## Call:
## lm(formula = racism.scores.post.1mon ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = filter(standard, anonymity <
## 2))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.4361 -0.1218 -0.0613 0.0430 0.9807
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.09954 0.11090 0.90 0.3722
## treat.f1 0.01464 0.08431 0.17 0.8626
## treat.f2 0.09853 0.08203 1.20 0.2334
## treat.f3 -0.05846 0.08589 -0.68 0.4982
## treat.f4 0.10268 0.08293 1.24 0.2195
## log.followers -0.00697 0.01470 -0.47 0.6369
## racism.scores.pre.2mon 0.84542 0.24205 3.49 0.0008 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.23 on 76 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.219, Adjusted R-squared: 0.157
## F-statistic: 3.55 on 6 and 76 DF, p-value: 0.00377
#2 months
(mon2_rac<-summary(lm(racism.scores.post.2mon ~ treat.f + log.followers + racism.scores.pre.2mon, data = standard)))
##
## Call:
## lm(formula = racism.scores.post.2mon ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = standard)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.0148 -0.1491 -0.0747 0.0445 2.4743
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.09128 0.08095 1.13 0.26
## treat.f1 0.06183 0.06667 0.93 0.35
## treat.f2 0.00656 0.06890 0.10 0.92
## treat.f3 -0.07614 0.06629 -1.15 0.25
## treat.f4 0.09234 0.06660 1.39 0.17
## log.followers -0.00238 0.01120 -0.21 0.83
## racism.scores.pre.2mon 0.76601 0.08138 9.41 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.33 on 235 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.298, Adjusted R-squared: 0.28
## F-statistic: 16.6 on 6 and 235 DF, p-value: 5.52e-16
(mon2_rac_anon<-summary(lm(racism.scores.post.2mon ~ treat.f + log.followers + racism.scores.pre.2mon,
data = filter(standard,anonymity>1))))
##
## Call:
## lm(formula = racism.scores.post.2mon ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = filter(standard, anonymity >
## 1))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.9872 -0.1793 -0.0609 0.0409 2.4106
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.10725 0.10648 1.01 0.32
## treat.f1 0.12131 0.08962 1.35 0.18
## treat.f2 0.00623 0.09713 0.06 0.95
## treat.f3 -0.07078 0.08800 -0.80 0.42
## treat.f4 0.13927 0.09031 1.54 0.13
## log.followers -0.00825 0.01486 -0.56 0.58
## racism.scores.pre.2mon 0.76536 0.09410 8.13 1.4e-13 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.37 on 152 degrees of freedom
## Multiple R-squared: 0.331, Adjusted R-squared: 0.305
## F-statistic: 12.5 on 6 and 152 DF, p-value: 1.82e-11
(mon2_rac_id<-summary(lm(racism.scores.post.2mon ~ treat.f + log.followers + racism.scores.pre.2mon,
data = filter(standard,anonymity<2))))
##
## Call:
## lm(formula = racism.scores.post.2mon ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = filter(standard, anonymity <
## 2))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.4293 -0.1172 -0.0539 0.0600 1.2117
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.040215 0.118814 0.34 0.7359
## treat.f1 -0.059389 0.090332 -0.66 0.5129
## treat.f2 -0.007942 0.087884 -0.09 0.9282
## treat.f3 -0.087191 0.092027 -0.95 0.3464
## treat.f4 0.000976 0.088852 0.01 0.9913
## log.followers 0.012684 0.015748 0.81 0.4231
## racism.scores.pre.2mon 0.863994 0.259330 3.33 0.0013 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.24 on 76 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.173, Adjusted R-squared: 0.108
## F-statistic: 2.65 on 6 and 76 DF, p-value: 0.0216
#########################################################################;
# File-Name: plot_results.R #;
# Date: September 28, 2016 #;
# Author: KM #;
# Purpose: Plot results #;
#########################################################################;
#############################This is to run the models divided by anonymity models
models<-list( wk2_rac_anon, wk2_rac_id, mon1_rac_anon, mon1_rac_id,
mon2_rac_anon, mon2_rac_id)
modelnames<-list( "wk2_rac_anon", "wk2_rac_id", "mon1_rac_anon", "mon1_rac_id",
"mon2_rac_anon", "mon2_rac_id")
##need to sepearate out the first ones to be the only ones that have labeled axes, for space
wk1_models<-list(wk1_rac_anon, wk1_rac_id)
wk1_modelnames<-list("wk1_rac_anon", "wk1_rac_id")
##############################This is to run the full models
models<-list( wk2_rac, mon1_rac, mon2_rac)
modelnames<-list( "wk2_rac", "mon1_rac", "mon2_rac" )
##need to sepearate out the first ones to be the only ones that have labeled axes, for space
wk1_models<-list(wk1_rac)
wk1_modelnames<-list("wk1_rac")
##plot the wk1 models, with axis labels
for (i in 1:length(wk1_models)){
##change length, one fewer coefficient
coefs <- t(t(c(wk1_models[[i]]$coefficients[2:6,1])))
ses <- t(t(c(wk1_models[[i]]$coefficients[2:6,2])))
y.axis <- c(1:5)
#fix x axis to the max values any coefficients take for comparison
min <- (-.65)
max <- .55
var.names <- c("In-Group/Low","Out-Group/Low","In-Group/High","Out-Group/High", "Log Followers")
adjust <- 0
##########################
###change filename depending on the data source
##########################
par(mar=c(4,6,1,1))
plot(coefs[,1], y.axis, type = "p", axes = F, xlab = "Change in Average Daily Slur Use", ylab = "", pch = 19, cex = .8,
xlim=c(min,max),ylim = c(.5,5.5), main = "")
rect(min,.5,max,1.5, col = c("grey97"), border="grey90", lty = 2)
rect(min,1.5,max,2.5, col = c("grey95"), border="grey90", lty = 2)
rect(min,2.5,max,3.5, col = c("grey97"), border="grey90", lty = 2)
rect(min,3.5,max,4.5, col = c("grey95"), border="grey90", lty = 2)
rect(min,4.5,max,5.5, col = c("grey97"), border="grey90", lty = 2)
axis(1, tick = T,cex.axis = .75, mgp = c(2,.7,0))
axis(2, at = y.axis, label = var.names, las = 1, tick = FALSE, cex.axis =.8, hadj=1)
abline(h = y.axis, lty = 2, lwd = .5, col = "white")
segments(coefs[,1]-qnorm(.975)*ses[,1], y.axis+2*adjust, coefs[,1]+qnorm(.975)*ses[,1], y.axis+2*adjust, lwd = 1)
segments(coefs[,1]-qnorm(.95)*ses[,1], y.axis+2*adjust-.035, coefs[,1]-qnorm(.95)*ses[,1], y.axis+2*adjust+.035, lwd = .9)
segments(coefs[,1]+qnorm(.95)*ses[,1], y.axis+2*adjust-.035, coefs[,1]+qnorm(.95)*ses[,1], y.axis+2*adjust+.035, lwd = .9)
points(coefs[,1], y.axis+2*adjust,pch=21,cex=.8, bg="white")
abline(v=0, lty = 2) # draw dotted line through 0 for reference line for null sign ificance hypothesis testing
}
##plot the other models, without axis labels
for (i in 1:length(models)){
##change length, one fewer coefficient
coefs <- t(t(c(models[[i]]$coefficients[2:6,1])))
ses <- t(t(c(models[[i]]$coefficients[2:6,2])))
y.axis <- c(1:5)
#fix x axis to the max values any coefficients take for comparison
min <- (-.65)
max <- .55
#var.names <- c("In-group/Low Followers","Out-group/Low Followers","In-group/High Followers","Out-group/High Followers", "Log Followers")
adjust <- 0
##########################
###change filename depending on the data source
##########################
par(mar=c(4,1,1,1))
plot(coefs[,1], y.axis, type = "p", axes = F, xlab = "", ylab = "", pch = 19, cex = .8,
xlim=c(min,max),ylim = c(.5,5.5), main = "")
rect(min,.5,max,1.5, col = c("grey97"), border="grey90", lty = 2)
rect(min,1.5,max,2.5, col = c("grey95"), border="grey90", lty = 2)
rect(min,2.5,max,3.5, col = c("grey97"), border="grey90", lty = 2)
rect(min,3.5,max,4.5, col = c("grey95"), border="grey90", lty = 2)
rect(min,4.5,max,5.5, col = c("grey97"), border="grey90", lty = 2)
?axis
axis(1, tick = T,cex.axis = .75, mgp = c(2,.7,0))
#axis(2, at = y.axis, label = var.names, las = 1, tick = FALSE, cex.axis =.8, hadj=1)
abline(h = y.axis, lty = 2, lwd = .5, col = "white")
segments(coefs[,1]-qnorm(.975)*ses[,1], y.axis+2*adjust, coefs[,1]+qnorm(.975)*ses[,1], y.axis+2*adjust, lwd = 1)
segments(coefs[,1]-qnorm(.95)*ses[,1], y.axis+2*adjust-.035, coefs[,1]-qnorm(.95)*ses[,1], y.axis+2*adjust+.035, lwd = .9)
segments(coefs[,1]+qnorm(.95)*ses[,1], y.axis+2*adjust-.035, coefs[,1]+qnorm(.95)*ses[,1], y.axis+2*adjust+.035, lwd = .9)
points(coefs[,1], y.axis+2*adjust,pch=21,cex=.8, bg="white")
abline(v=0, lty = 2) # draw dotted line through 0 for reference line for null sign ificance hypothesis testing
}
#1 week time period
##first model is the full analysis
(wk1_rac<-summary(lm(racism.scores.post.1wk ~ treat.f + log.followers + racism.scores.pre.2mon, data = conservative)))
##
## Call:
## lm(formula = racism.scores.post.1wk ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = conservative)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.162 -0.299 -0.159 0.060 3.182
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.26526 0.15009 1.77 0.078 .
## treat.f1 -0.07726 0.12360 -0.63 0.533
## treat.f2 -0.00653 0.12773 -0.05 0.959
## treat.f3 -0.24835 0.12289 -2.02 0.044 *
## treat.f4 -0.05903 0.12347 -0.48 0.633
## log.followers 0.01023 0.02077 0.49 0.623
## racism.scores.pre.2mon 1.33795 0.15088 8.87 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.61 on 235 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.281, Adjusted R-squared: 0.263
## F-statistic: 15.3 on 6 and 235 DF, p-value: 8.64e-15
##second model looks only at the most anonymous users
(wk1_rac_anon<-summary(lm(racism.scores.post.1wk ~ treat.f + log.followers + racism.scores.pre.2mon,
data = filter(conservative,anonymity>1) )))
##
## Call:
## lm(formula = racism.scores.post.1wk ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = filter(conservative, anonymity >
## 1))
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.1118 -0.3381 -0.2003 0.0843 3.1267
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.3650 0.2031 1.80 0.074 .
## treat.f1 -0.1306 0.1710 -0.76 0.446
## treat.f2 -0.1298 0.1853 -0.70 0.485
## treat.f3 -0.3252 0.1679 -1.94 0.055 .
## treat.f4 -0.1291 0.1723 -0.75 0.455
## log.followers 0.0114 0.0283 0.40 0.689
## racism.scores.pre.2mon 1.2881 0.1795 7.18 2.9e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7 on 152 degrees of freedom
## Multiple R-squared: 0.293, Adjusted R-squared: 0.265
## F-statistic: 10.5 on 6 and 152 DF, p-value: 0.00000000104
##third model looks at non-anonymous users
(wk1_rac_id<-summary(lm(racism.scores.post.1wk ~ treat.f + log.followers + racism.scores.pre.2mon,
data = filter(conservative,anonymity<2))))
##
## Call:
## lm(formula = racism.scores.post.1wk ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = filter(conservative, anonymity <
## 2))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.6957 -0.1929 -0.0870 0.0859 1.5857
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.00115 0.18742 -0.01 0.9951
## treat.f1 0.09957 0.14249 0.70 0.4868
## treat.f2 0.28402 0.13863 2.05 0.0439 *
## treat.f3 -0.03419 0.14517 -0.24 0.8144
## treat.f4 0.13406 0.14016 0.96 0.3418
## log.followers 0.00798 0.02484 0.32 0.7489
## racism.scores.pre.2mon 1.55161 0.40907 3.79 0.0003 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.39 on 76 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.224, Adjusted R-squared: 0.162
## F-statistic: 3.65 on 6 and 76 DF, p-value: 0.0031
#2weeks
(wk2_rac<-summary(lm(racism.scores.post.2wk ~ treat.f+ log.followers + racism.scores.pre.2mon, data = conservative)))
##
## Call:
## lm(formula = racism.scores.post.2wk ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = conservative)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.086 -0.204 -0.110 0.061 1.587
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.21657 0.08952 2.42 0.016 *
## treat.f1 -0.02266 0.07372 -0.31 0.759
## treat.f2 0.00714 0.07618 0.09 0.925
## treat.f3 -0.14856 0.07330 -2.03 0.044 *
## treat.f4 0.01227 0.07364 0.17 0.868
## log.followers -0.00406 0.01239 -0.33 0.743
## racism.scores.pre.2mon 0.95477 0.08999 10.61 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.36 on 235 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.353, Adjusted R-squared: 0.336
## F-statistic: 21.4 on 6 and 235 DF, p-value: <2e-16
(wk2_rac_anon<-summary(lm(racism.scores.post.2wk ~ treat.f + log.followers + racism.scores.pre.2mon,
data = filter(conservative,anonymity>1))))
##
## Call:
## lm(formula = racism.scores.post.2wk ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = filter(conservative, anonymity >
## 1))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.9009 -0.2108 -0.1221 0.0547 1.6012
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.24475 0.11479 2.13 0.035 *
## treat.f1 -0.04701 0.09662 -0.49 0.627
## treat.f2 -0.07735 0.10471 -0.74 0.461
## treat.f3 -0.18381 0.09488 -1.94 0.055 .
## treat.f4 -0.07552 0.09736 -0.78 0.439
## log.followers 0.00201 0.01602 0.13 0.900
## racism.scores.pre.2mon 0.87828 0.10145 8.66 6.5e-15 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4 on 152 degrees of freedom
## Multiple R-squared: 0.368, Adjusted R-squared: 0.343
## F-statistic: 14.7 on 6 and 152 DF, p-value: 3.11e-13
(wk2_rac_id<-summary(lm(racism.scores.post.2wk ~ treat.f + log.followers + racism.scores.pre.2mon,
data = filter(conservative,anonymity<2))))
##
## Call:
## lm(formula = racism.scores.post.2wk ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = filter(conservative, anonymity <
## 2))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.4268 -0.1509 -0.0536 0.0772 0.9680
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.01306 0.13542 0.10 0.923
## treat.f1 0.09728 0.10296 0.94 0.348
## treat.f2 0.20892 0.10017 2.09 0.040 *
## treat.f3 -0.01380 0.10489 -0.13 0.896
## treat.f4 0.18009 0.10127 1.78 0.079 .
## log.followers -0.00915 0.01795 -0.51 0.611
## racism.scores.pre.2mon 1.89325 0.29557 6.41 0.000000011 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.28 on 76 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.417, Adjusted R-squared: 0.371
## F-statistic: 9.08 on 6 and 76 DF, p-value: 0.000000177
#1month
(mon1_rac<-summary(lm(racism.scores.post.1mon ~ treat.f + log.followers + racism.scores.pre.2mon, data = conservative)))
##
## Call:
## lm(formula = racism.scores.post.1mon ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = conservative)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.7043 -0.1555 -0.0974 0.0424 1.7897
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.15243 0.07528 2.02 0.044 *
## treat.f1 0.01336 0.06200 0.22 0.830
## treat.f2 0.00677 0.06407 0.11 0.916
## treat.f3 -0.09533 0.06164 -1.55 0.123
## treat.f4 0.05201 0.06193 0.84 0.402
## log.followers -0.00436 0.01042 -0.42 0.676
## racism.scores.pre.2mon 0.80851 0.07568 10.68 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.31 on 235 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.351, Adjusted R-squared: 0.335
## F-statistic: 21.2 on 6 and 235 DF, p-value: <2e-16
(mon1_rac_anon<-summary(lm(racism.scores.post.1mon ~ treat.f + log.followers + racism.scores.pre.2mon,
data = filter(conservative,anonymity>1))))
##
## Call:
## lm(formula = racism.scores.post.1mon ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = filter(conservative, anonymity >
## 1))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.6933 -0.1765 -0.0872 0.0462 1.7828
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.18135 0.10018 1.81 0.072 .
## treat.f1 0.01973 0.08433 0.23 0.815
## treat.f2 -0.04468 0.09138 -0.49 0.626
## treat.f3 -0.11081 0.08280 -1.34 0.183
## treat.f4 0.01290 0.08497 0.15 0.880
## log.followers -0.00434 0.01398 -0.31 0.756
## racism.scores.pre.2mon 0.78671 0.08854 8.89 1.7e-15 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.34 on 152 degrees of freedom
## Multiple R-squared: 0.369, Adjusted R-squared: 0.344
## F-statistic: 14.8 on 6 and 152 DF, p-value: 2.75e-13
(mon1_rac_id<-summary(lm(racism.scores.post.1mon ~ treat.f + log.followers + racism.scores.pre.2mon,
data = filter(conservative,anonymity<2))))
##
## Call:
## lm(formula = racism.scores.post.1mon ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = filter(conservative, anonymity <
## 2))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.2375 -0.1356 -0.0605 0.0333 0.9480
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.0494 0.1059 0.47 0.643
## treat.f1 0.0253 0.0805 0.31 0.754
## treat.f2 0.1100 0.0784 1.40 0.164
## treat.f3 -0.0443 0.0820 -0.54 0.591
## treat.f4 0.1387 0.0792 1.75 0.084 .
## log.followers -0.0007 0.0140 -0.05 0.960
## racism.scores.pre.2mon 0.9598 0.2312 4.15 0.000086 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.22 on 76 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.277, Adjusted R-squared: 0.22
## F-statistic: 4.85 on 6 and 76 DF, p-value: 0.000304
#2 months
(mon2_rac<-summary(lm(racism.scores.post.2mon ~ treat.f + log.followers + racism.scores.pre.2mon, data = conservative)))
##
## Call:
## lm(formula = racism.scores.post.2mon ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = conservative)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.0390 -0.1443 -0.0714 0.0426 2.4748
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.079068 0.080289 0.98 0.33
## treat.f1 0.065226 0.066120 0.99 0.32
## treat.f2 0.009759 0.068330 0.14 0.89
## treat.f3 -0.064526 0.065740 -0.98 0.33
## treat.f4 0.106040 0.066051 1.61 0.11
## log.followers -0.000704 0.011110 -0.06 0.95
## racism.scores.pre.2mon 0.779242 0.080714 9.65 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.33 on 235 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.307, Adjusted R-squared: 0.29
## F-statistic: 17.4 on 6 and 235 DF, p-value: <2e-16
(mon2_rac_anon<-summary(lm(racism.scores.post.2mon ~ treat.f + log.followers + racism.scores.pre.2mon,
data = filter(conservative,anonymity>1))))
##
## Call:
## lm(formula = racism.scores.post.2mon ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = filter(conservative, anonymity >
## 1))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.9987 -0.1741 -0.0608 0.0465 2.4092
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.10249 0.10619 0.97 0.34
## treat.f1 0.12377 0.08939 1.38 0.17
## treat.f2 0.00689 0.09687 0.07 0.94
## treat.f3 -0.05760 0.08777 -0.66 0.51
## treat.f4 0.14083 0.09007 1.56 0.12
## log.followers -0.00764 0.01482 -0.52 0.61
## racism.scores.pre.2mon 0.77181 0.09385 8.22 8.1e-14 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.36 on 152 degrees of freedom
## Multiple R-squared: 0.333, Adjusted R-squared: 0.307
## F-statistic: 12.7 on 6 and 152 DF, p-value: 1.43e-11
(mon2_rac_id<-summary(lm(racism.scores.post.2mon ~ treat.f + log.followers + racism.scores.pre.2mon,
data = filter(conservative,anonymity<2))))
##
## Call:
## lm(formula = racism.scores.post.2mon ~ treat.f + log.followers +
## racism.scores.pre.2mon, data = filter(conservative, anonymity <
## 2))
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.3299 -0.1218 -0.0572 0.0664 1.1702
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.00823 0.11442 -0.07 0.94285
## treat.f1 -0.04980 0.08699 -0.57 0.56870
## treat.f2 0.00347 0.08464 0.04 0.96738
## treat.f3 -0.07320 0.08863 -0.83 0.41140
## treat.f4 0.03683 0.08557 0.43 0.66807
## log.followers 0.01864 0.01517 1.23 0.22282
## racism.scores.pre.2mon 0.97870 0.24975 3.92 0.00019 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.24 on 76 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.227, Adjusted R-squared: 0.166
## F-statistic: 3.73 on 6 and 76 DF, p-value: 0.00265
{
##change length, one fewer coefficient
coefs <- t(t(c(models[[i]]$coefficients[2:6,1])))
ses <- t(t(c(models[[i]]$coefficients[2:6,2])))
y.axis <- c(1:5)
#fix x axis to the max values any coefficients take for comparison
min <- (-.65)
max <- .55
#var.names <- c("In-group/Low Followers","Out-group/Low Followers","In-group/High Followers","Out-group/High Followers", "Log Followers")
adjust <- 0
##########################
###change filename depending on the data source
##########################
par(mar=c(4,1,1,1))
plot(coefs[,1], y.axis, type = "p", axes = F, xlab = "", ylab = "", pch = 19, cex = .8,
xlim=c(min,max),ylim = c(.5,5.5), main = "")
rect(min,.5,max,1.5, col = c("grey97"), border="grey90", lty = 2)
rect(min,1.5,max,2.5, col = c("grey95"), border="grey90", lty = 2)
rect(min,2.5,max,3.5, col = c("grey97"), border="grey90", lty = 2)
rect(min,3.5,max,4.5, col = c("grey95"), border="grey90", lty = 2)
rect(min,4.5,max,5.5, col = c("grey97"), border="grey90", lty = 2)
?axis
axis(1, tick = T,cex.axis = .75, mgp = c(2,.7,0))
#axis(2, at = y.axis, label = var.names, las = 1, tick = FALSE, cex.axis =.8, hadj=1)
abline(h = y.axis, lty = 2, lwd = .5, col = "white")
segments(coefs[,1]-qnorm(.975)*ses[,1], y.axis+2*adjust, coefs[,1]+qnorm(.975)*ses[,1], y.axis+2*adjust, lwd = 1)
segments(coefs[,1]-qnorm(.95)*ses[,1], y.axis+2*adjust-.035, coefs[,1]-qnorm(.95)*ses[,1], y.axis+2*adjust+.035, lwd = .9)
segments(coefs[,1]+qnorm(.95)*ses[,1], y.axis+2*adjust-.035, coefs[,1]+qnorm(.95)*ses[,1], y.axis+2*adjust+.035, lwd = .9)
points(coefs[,1], y.axis+2*adjust,pch=21,cex=.8, bg="white")
abline(v=0, lty = 2) # draw dotted line through 0 for reference line for null sign ificance hypothesis testing
}
Using Bayesian regression modelling and a Poisson distribution.
Reproduce full analysis with a different distribution for the outcome (Poisson instead normal)
library(ggplot2)
standard$anonymity = factor(standard$anonymity)
qplot(standard$racism.scores.post.1wk) # looks like Poisson or zero-inflated Poisson
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
library(brms)
standard$racism.counts.post.1wk = round(standard$racism.scores.post.1wk * 7)
standard$racism.counts.post.2wk = round(standard$racism.scores.post.2wk * 14)
standard$racism.counts.post.1mon = round(standard$racism.scores.post.1mon * 31)
standard$racism.counts.post.2mon = round(standard$racism.scores.post.2mon * 62)
table(standard$racism.counts.post.1wk <= standard$racism.counts.post.2wk)
##
## TRUE
## 243
qplot(standard$racism.counts.post.1mon, standard$racism.counts.post.1wk)
standard$racism.counts.post.2wk_inclusive = standard$racism.counts.post.2wk
standard$racism.counts.post.2wk = standard$racism.counts.post.2wk - standard$racism.counts.post.1wk
(wk1_rac <- brm(racism.counts.post.1wk ~ treatment + log.followers + racism.scores.pre.2mon, data = standard, family = poisson))
## Warning: Rows containing NAs were excluded from the model
## Compiling the C++ model
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 1).
##
## Chain 1, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 1, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 1, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 1, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 1, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 1, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 1, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 1, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 1, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 1, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.14802 seconds (Warm-up)
## 0.130461 seconds (Sampling)
## 0.278481 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 2).
##
## Chain 2, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 2, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 2, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 2, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 2, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 2, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 2, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 2, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 2, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 2, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.140448 seconds (Warm-up)
## 0.131045 seconds (Sampling)
## 0.271493 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 3).
##
## Chain 3, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 3, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 3, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 3, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 3, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 3, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 3, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 3, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 3, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 3, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.164494 seconds (Warm-up)
## 0.133411 seconds (Sampling)
## 0.297905 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 4).
##
## Chain 4, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 4, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 4, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 4, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 4, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 4, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 4, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 4, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 4, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 4, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.138717 seconds (Warm-up)
## 0.132863 seconds (Sampling)
## 0.27158 seconds (Total)
## Family: poisson (log)
## Formula: racism.counts.post.1wk ~ treatment + log.followers + racism.scores.pre.2mon
## Data: standard (Number of observations: 242)
## Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
## total post-warmup samples = 4000
## WAIC: Not computed
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept 0.86 0.14 0.59 1.14 2039
## treatmentInMGroupDHigh -0.90 0.14 -1.18 -0.62 2190
## treatmentInMGroupDLow -0.18 0.11 -0.40 0.03 2311
## treatmentOutMGroupDHigh -0.17 0.11 -0.39 0.04 2330
## treatmentOutMGroupDLow -0.08 0.11 -0.31 0.14 2264
## log.followers 0.03 0.02 0.00 0.07 2657
## racism.scores.pre.2mon 0.90 0.05 0.79 1.00 2347
## Rhat
## Intercept 1
## treatmentInMGroupDHigh 1
## treatmentInMGroupDLow 1
## treatmentOutMGroupDHigh 1
## treatmentOutMGroupDLow 1
## log.followers 1
## racism.scores.pre.2mon 1
##
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
## is a crude measure of effective sample size, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
summary(wk1_rac)
## Family: poisson (log)
## Formula: racism.counts.post.1wk ~ treatment + log.followers + racism.scores.pre.2mon
## Data: standard (Number of observations: 242)
## Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
## total post-warmup samples = 4000
## WAIC: Not computed
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept 0.86 0.14 0.59 1.14 2039
## treatmentInMGroupDHigh -0.90 0.14 -1.18 -0.62 2190
## treatmentInMGroupDLow -0.18 0.11 -0.40 0.03 2311
## treatmentOutMGroupDHigh -0.17 0.11 -0.39 0.04 2330
## treatmentOutMGroupDLow -0.08 0.11 -0.31 0.14 2264
## log.followers 0.03 0.02 0.00 0.07 2657
## racism.scores.pre.2mon 0.90 0.05 0.79 1.00 2347
## Rhat
## Intercept 1
## treatmentInMGroupDHigh 1
## treatmentInMGroupDLow 1
## treatmentOutMGroupDHigh 1
## treatmentOutMGroupDLow 1
## log.followers 1
## racism.scores.pre.2mon 1
##
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
## is a crude measure of effective sample size, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
marginal_effects(wk1_rac)
standard$racism.counts.post.2mon = round(standard$racism.scores.post.2mon * 30)
Does the effect last? We have to subtract the counts from the first week so as not to do pseudo-replication.
(wk2i_rac <- brm(racism.counts.post.2wk_inclusive ~ treatment + log.followers + racism.scores.pre.2mon, data = standard, family = poisson))
## Warning: Rows containing NAs were excluded from the model
## Compiling the C++ model
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 1).
##
## Chain 1, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 1, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 1, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 1, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 1, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 1, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 1, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 1, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 1, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 1, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.132378 seconds (Warm-up)
## 0.109211 seconds (Sampling)
## 0.241589 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 2).
##
## Chain 2, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 2, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 2, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 2, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 2, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 2, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 2, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 2, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 2, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 2, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.143307 seconds (Warm-up)
## 0.115063 seconds (Sampling)
## 0.25837 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 3).
##
## Chain 3, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 3, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 3, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 3, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 3, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 3, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 3, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 3, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 3, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 3, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.140811 seconds (Warm-up)
## 0.141313 seconds (Sampling)
## 0.282124 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 4).
##
## Chain 4, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 4, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 4, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 4, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 4, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 4, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 4, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 4, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 4, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 4, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.133486 seconds (Warm-up)
## 0.126558 seconds (Sampling)
## 0.260044 seconds (Total)
## Family: poisson (log)
## Formula: racism.counts.post.2wk_inclusive ~ treatment + log.followers + racism.scores.pre.2mon
## Data: standard (Number of observations: 242)
## Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
## total post-warmup samples = 4000
## WAIC: Not computed
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept 1.37 0.12 1.14 1.61 1721
## treatmentInMGroupDHigh -0.86 0.12 -1.11 -0.63 1857
## treatmentInMGroupDLow -0.09 0.10 -0.29 0.10 1804
## treatmentOutMGroupDHigh -0.01 0.09 -0.20 0.17 1860
## treatmentOutMGroupDLow -0.05 0.10 -0.25 0.14 1806
## log.followers -0.01 0.02 -0.05 0.02 2307
## racism.scores.pre.2mon 0.91 0.05 0.82 1.00 1843
## Rhat
## Intercept 1
## treatmentInMGroupDHigh 1
## treatmentInMGroupDLow 1
## treatmentOutMGroupDHigh 1
## treatmentOutMGroupDLow 1
## log.followers 1
## racism.scores.pre.2mon 1
##
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
## is a crude measure of effective sample size, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
marginal_effects(wk2i_rac)
(wk2_rac <- brm(racism.counts.post.2wk ~ treatment + log.followers + racism.scores.pre.2mon, data = standard, family = poisson))
## Warning: Rows containing NAs were excluded from the model
## Compiling the C++ model
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 1).
##
## Chain 1, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 1, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 1, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 1, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 1, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 1, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 1, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 1, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 1, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 1, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.162284 seconds (Warm-up)
## 0.137532 seconds (Sampling)
## 0.299816 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 2).
##
## Chain 2, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 2, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 2, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 2, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 2, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 2, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 2, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 2, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 2, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 2, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.149254 seconds (Warm-up)
## 0.146449 seconds (Sampling)
## 0.295703 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 3).
##
## Chain 3, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 3, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 3, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 3, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 3, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 3, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 3, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 3, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 3, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 3, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.150278 seconds (Warm-up)
## 0.129448 seconds (Sampling)
## 0.279726 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 4).
##
## Chain 4, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 4, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 4, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 4, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 4, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 4, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 4, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 4, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 4, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 4, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.154971 seconds (Warm-up)
## 0.142913 seconds (Sampling)
## 0.297884 seconds (Total)
## Family: poisson (log)
## Formula: racism.counts.post.2wk ~ treatment + log.followers + racism.scores.pre.2mon
## Data: standard (Number of observations: 242)
## Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
## total post-warmup samples = 4000
## WAIC: Not computed
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept 0.45 0.23 0.01 0.90 1895
## treatmentInMGroupDHigh -0.73 0.24 -1.23 -0.27 2036
## treatmentInMGroupDLow 0.16 0.19 -0.21 0.55 1970
## treatmentOutMGroupDHigh 0.41 0.18 0.06 0.77 1834
## treatmentOutMGroupDLow 0.05 0.21 -0.37 0.46 2068
## log.followers -0.13 0.03 -0.19 -0.06 2713
## racism.scores.pre.2mon 0.96 0.09 0.79 1.13 1887
## Rhat
## Intercept 1
## treatmentInMGroupDHigh 1
## treatmentInMGroupDLow 1
## treatmentOutMGroupDHigh 1
## treatmentOutMGroupDLow 1
## log.followers 1
## racism.scores.pre.2mon 1
##
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
## is a crude measure of effective sample size, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
marginal_effects(wk2_rac)
standard$racism.counts.post.1mon = standard$racism.counts.post.1mon - standard$racism.counts.post.2wk
(mon1_rac <- brm(racism.counts.post.1mon ~ treatment + log.followers + racism.scores.pre.2mon, data = standard, family = poisson))
## Warning: Rows containing NAs were excluded from the model
## Compiling the C++ model
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 1).
##
## Chain 1, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 1, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 1, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 1, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 1, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 1, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 1, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 1, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 1, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 1, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.145714 seconds (Warm-up)
## 0.130953 seconds (Sampling)
## 0.276667 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 2).
##
## Chain 2, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 2, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 2, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 2, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 2, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 2, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 2, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 2, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 2, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 2, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.152916 seconds (Warm-up)
## 0.111132 seconds (Sampling)
## 0.264048 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 3).
##
## Chain 3, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 3, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 3, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 3, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 3, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 3, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 3, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 3, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 3, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 3, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.131837 seconds (Warm-up)
## 0.123611 seconds (Sampling)
## 0.255448 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 4).
##
## Chain 4, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 4, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 4, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 4, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 4, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 4, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 4, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 4, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 4, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 4, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.122072 seconds (Warm-up)
## 0.102974 seconds (Sampling)
## 0.225046 seconds (Total)
## Family: poisson (log)
## Formula: racism.counts.post.1mon ~ treatment + log.followers + racism.scores.pre.2mon
## Data: standard (Number of observations: 242)
## Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
## total post-warmup samples = 4000
## WAIC: Not computed
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept 1.62 0.10 1.43 1.82 2036
## treatmentInMGroupDHigh -0.79 0.10 -0.99 -0.60 1934
## treatmentInMGroupDLow 0.01 0.08 -0.15 0.17 1946
## treatmentOutMGroupDHigh 0.11 0.08 -0.04 0.26 1666
## treatmentOutMGroupDLow -0.09 0.09 -0.26 0.08 1906
## log.followers 0.00 0.01 -0.02 0.03 2807
## racism.scores.pre.2mon 0.96 0.04 0.88 1.03 2131
## Rhat
## Intercept 1
## treatmentInMGroupDHigh 1
## treatmentInMGroupDLow 1
## treatmentOutMGroupDHigh 1
## treatmentOutMGroupDLow 1
## log.followers 1
## racism.scores.pre.2mon 1
##
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
## is a crude measure of effective sample size, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
summary(mon1_rac)
## Family: poisson (log)
## Formula: racism.counts.post.1mon ~ treatment + log.followers + racism.scores.pre.2mon
## Data: standard (Number of observations: 242)
## Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
## total post-warmup samples = 4000
## WAIC: Not computed
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept 1.62 0.10 1.43 1.82 2036
## treatmentInMGroupDHigh -0.79 0.10 -0.99 -0.60 1934
## treatmentInMGroupDLow 0.01 0.08 -0.15 0.17 1946
## treatmentOutMGroupDHigh 0.11 0.08 -0.04 0.26 1666
## treatmentOutMGroupDLow -0.09 0.09 -0.26 0.08 1906
## log.followers 0.00 0.01 -0.02 0.03 2807
## racism.scores.pre.2mon 0.96 0.04 0.88 1.03 2131
## Rhat
## Intercept 1
## treatmentInMGroupDHigh 1
## treatmentInMGroupDLow 1
## treatmentOutMGroupDHigh 1
## treatmentOutMGroupDLow 1
## log.followers 1
## racism.scores.pre.2mon 1
##
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
## is a crude measure of effective sample size, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
marginal_effects(mon1_rac)
(mon2_rac <- brm(racism.counts.post.2mon ~ treatment + log.followers + racism.scores.pre.2mon, data = standard, family = poisson))
## Warning: Rows containing NAs were excluded from the model
## Compiling the C++ model
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 1).
##
## Chain 1, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 1, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 1, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 1, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 1, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 1, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 1, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 1, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 1, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 1, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.142489 seconds (Warm-up)
## 0.119407 seconds (Sampling)
## 0.261896 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 2).
##
## Chain 2, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 2, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 2, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 2, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 2, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 2, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 2, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 2, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 2, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 2, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.143984 seconds (Warm-up)
## 0.136988 seconds (Sampling)
## 0.280972 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 3).
##
## Chain 3, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 3, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 3, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 3, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 3, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 3, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 3, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 3, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 3, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 3, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.173799 seconds (Warm-up)
## 0.164478 seconds (Sampling)
## 0.338277 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 4).
##
## Chain 4, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 4, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 4, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 4, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 4, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 4, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 4, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 4, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 4, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 4, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.185168 seconds (Warm-up)
## 0.163248 seconds (Sampling)
## 0.348416 seconds (Total)
## Family: poisson (log)
## Formula: racism.counts.post.2mon ~ treatment + log.followers + racism.scores.pre.2mon
## Data: standard (Number of observations: 242)
## Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
## total post-warmup samples = 4000
## WAIC: Not computed
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept 1.41 0.10 1.20 1.61 1590
## treatmentInMGroupDHigh -0.82 0.11 -1.04 -0.61 2246
## treatmentInMGroupDLow 0.32 0.08 0.16 0.48 1928
## treatmentOutMGroupDHigh 0.44 0.08 0.29 0.60 1838
## treatmentOutMGroupDLow -0.08 0.09 -0.26 0.11 2064
## log.followers 0.00 0.01 -0.03 0.03 2345
## racism.scores.pre.2mon 1.06 0.04 0.99 1.13 1754
## Rhat
## Intercept 1
## treatmentInMGroupDHigh 1
## treatmentInMGroupDLow 1
## treatmentOutMGroupDHigh 1
## treatmentOutMGroupDLow 1
## log.followers 1
## racism.scores.pre.2mon 1
##
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
## is a crude measure of effective sample size, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
summary(mon2_rac)
## Family: poisson (log)
## Formula: racism.counts.post.2mon ~ treatment + log.followers + racism.scores.pre.2mon
## Data: standard (Number of observations: 242)
## Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
## total post-warmup samples = 4000
## WAIC: Not computed
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept 1.41 0.10 1.20 1.61 1590
## treatmentInMGroupDHigh -0.82 0.11 -1.04 -0.61 2246
## treatmentInMGroupDLow 0.32 0.08 0.16 0.48 1928
## treatmentOutMGroupDHigh 0.44 0.08 0.29 0.60 1838
## treatmentOutMGroupDLow -0.08 0.09 -0.26 0.11 2064
## log.followers 0.00 0.01 -0.03 0.03 2345
## racism.scores.pre.2mon 1.06 0.04 0.99 1.13 1754
## Rhat
## Intercept 1
## treatmentInMGroupDHigh 1
## treatmentInMGroupDLow 1
## treatmentOutMGroupDHigh 1
## treatmentOutMGroupDLow 1
## log.followers 1
## racism.scores.pre.2mon 1
##
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
## is a crude measure of effective sample size, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
marginal_effects(mon2_rac)
(mon2_racanon <- brm(racism.counts.post.2mon ~ anonymity * treatment + log.followers + racism.scores.pre.2mon, data = standard, family = poisson))
## Warning: Rows containing NAs were excluded from the model
## Compiling the C++ model
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 1).
##
## Chain 1, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 1, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 1, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 1, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 1, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 1, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 1, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 1, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 1, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 1, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 3.52268 seconds (Warm-up)
## 3.38578 seconds (Sampling)
## 6.90846 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 2).
##
## Chain 2, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 2, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 2, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 2, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 2, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 2, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 2, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 2, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 2, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 2, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 3.70505 seconds (Warm-up)
## 3.86685 seconds (Sampling)
## 7.57191 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 3).
##
## Chain 3, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 3, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 3, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 3, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 3, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 3, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 3, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 3, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 3, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 3, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 2.99608 seconds (Warm-up)
## 3.37244 seconds (Sampling)
## 6.36853 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 4).
##
## Chain 4, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 4, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 4, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 4, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 4, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 4, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 4, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 4, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 4, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 4, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 3.40573 seconds (Warm-up)
## 3.89336 seconds (Sampling)
## 7.2991 seconds (Total)
## Family: poisson (log)
## Formula: racism.counts.post.2mon ~ anonymity * treatment + log.followers + racism.scores.pre.2mon
## Data: standard (Number of observations: 242)
## Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
## total post-warmup samples = 4000
## WAIC: Not computed
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI
## Intercept 1.05 0.23 0.56 1.48
## anonymity1 1.10 0.24 0.65 1.61
## anonymity2 0.26 0.23 -0.15 0.75
## treatmentInMGroupDHigh -0.76 0.40 -1.57 0.01
## treatmentInMGroupDLow -2.81 1.32 -6.11 -0.81
## treatmentOutMGroupDHigh -0.74 0.40 -1.54 0.00
## treatmentOutMGroupDLow 0.94 0.27 0.42 1.49
## log.followers -0.01 0.01 -0.03 0.02
## racism.scores.pre.2mon 1.10 0.04 1.01 1.18
## anonymity1:treatmentInMGroupDHigh -0.63 0.47 -1.52 0.34
## anonymity2:treatmentInMGroupDHigh 0.06 0.43 -0.76 0.92
## anonymity1:treatmentInMGroupDLow 1.86 1.33 -0.20 5.14
## anonymity2:treatmentInMGroupDLow 3.49 1.33 1.47 6.80
## anonymity1:treatmentOutMGroupDHigh 0.60 0.43 -0.21 1.46
## anonymity2:treatmentOutMGroupDHigh 1.40 0.41 0.62 2.23
## anonymity1:treatmentOutMGroupDLow -1.80 0.32 -2.44 -1.19
## anonymity2:treatmentOutMGroupDLow -1.01 0.31 -1.63 -0.44
## Eff.Sample Rhat
## Intercept 1492 1
## anonymity1 1449 1
## anonymity2 1424 1
## treatmentInMGroupDHigh 1594 1
## treatmentInMGroupDLow 1300 1
## treatmentOutMGroupDHigh 1649 1
## treatmentOutMGroupDLow 1543 1
## log.followers 4000 1
## racism.scores.pre.2mon 3695 1
## anonymity1:treatmentInMGroupDHigh 1755 1
## anonymity2:treatmentInMGroupDHigh 1606 1
## anonymity1:treatmentInMGroupDLow 1295 1
## anonymity2:treatmentInMGroupDLow 1294 1
## anonymity1:treatmentOutMGroupDHigh 1616 1
## anonymity2:treatmentOutMGroupDHigh 1616 1
## anonymity1:treatmentOutMGroupDLow 1650 1
## anonymity2:treatmentOutMGroupDLow 1633 1
##
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
## is a crude measure of effective sample size, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
summary(mon2_racanon)
## Family: poisson (log)
## Formula: racism.counts.post.2mon ~ anonymity * treatment + log.followers + racism.scores.pre.2mon
## Data: standard (Number of observations: 242)
## Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
## total post-warmup samples = 4000
## WAIC: Not computed
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI
## Intercept 1.05 0.23 0.56 1.48
## anonymity1 1.10 0.24 0.65 1.61
## anonymity2 0.26 0.23 -0.15 0.75
## treatmentInMGroupDHigh -0.76 0.40 -1.57 0.01
## treatmentInMGroupDLow -2.81 1.32 -6.11 -0.81
## treatmentOutMGroupDHigh -0.74 0.40 -1.54 0.00
## treatmentOutMGroupDLow 0.94 0.27 0.42 1.49
## log.followers -0.01 0.01 -0.03 0.02
## racism.scores.pre.2mon 1.10 0.04 1.01 1.18
## anonymity1:treatmentInMGroupDHigh -0.63 0.47 -1.52 0.34
## anonymity2:treatmentInMGroupDHigh 0.06 0.43 -0.76 0.92
## anonymity1:treatmentInMGroupDLow 1.86 1.33 -0.20 5.14
## anonymity2:treatmentInMGroupDLow 3.49 1.33 1.47 6.80
## anonymity1:treatmentOutMGroupDHigh 0.60 0.43 -0.21 1.46
## anonymity2:treatmentOutMGroupDHigh 1.40 0.41 0.62 2.23
## anonymity1:treatmentOutMGroupDLow -1.80 0.32 -2.44 -1.19
## anonymity2:treatmentOutMGroupDLow -1.01 0.31 -1.63 -0.44
## Eff.Sample Rhat
## Intercept 1492 1
## anonymity1 1449 1
## anonymity2 1424 1
## treatmentInMGroupDHigh 1594 1
## treatmentInMGroupDLow 1300 1
## treatmentOutMGroupDHigh 1649 1
## treatmentOutMGroupDLow 1543 1
## log.followers 4000 1
## racism.scores.pre.2mon 3695 1
## anonymity1:treatmentInMGroupDHigh 1755 1
## anonymity2:treatmentInMGroupDHigh 1606 1
## anonymity1:treatmentInMGroupDLow 1295 1
## anonymity2:treatmentInMGroupDLow 1294 1
## anonymity1:treatmentOutMGroupDHigh 1616 1
## anonymity2:treatmentOutMGroupDHigh 1616 1
## anonymity1:treatmentOutMGroupDLow 1650 1
## anonymity2:treatmentOutMGroupDLow 1633 1
##
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
## is a crude measure of effective sample size, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
marginal_effects(mon2_racanon)
Let’s see whether the groups differed at the outset. Yes, some outliers, good to control for this heterogeneity.
standard$racism.counts.pre.2mon = round(standard$racism.scores.pre.2mon * 62)
(backwards_2m <- brm(racism.counts.pre.2mon ~ treatment + log.followers, data = standard, family = poisson))
## Warning: Rows containing NAs were excluded from the model
## Compiling the C++ model
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 1).
##
## Chain 1, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 1, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 1, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 1, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 1, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 1, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 1, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 1, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 1, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 1, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.125659 seconds (Warm-up)
## 0.106321 seconds (Sampling)
## 0.23198 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 2).
##
## Chain 2, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 2, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 2, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 2, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 2, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 2, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 2, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 2, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 2, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 2, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.114999 seconds (Warm-up)
## 0.098032 seconds (Sampling)
## 0.213031 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 3).
##
## Chain 3, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 3, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 3, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 3, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 3, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 3, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 3, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 3, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 3, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 3, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.115555 seconds (Warm-up)
## 0.104943 seconds (Sampling)
## 0.220498 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 4).
##
## Chain 4, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 4, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 4, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 4, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 4, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 4, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 4, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 4, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 4, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 4, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.104868 seconds (Warm-up)
## 0.086201 seconds (Sampling)
## 0.191069 seconds (Total)
## Family: poisson (log)
## Formula: racism.counts.pre.2mon ~ treatment + log.followers
## Data: standard (Number of observations: 242)
## Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
## total post-warmup samples = 4000
## WAIC: Not computed
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept 2.89 0.07 2.75 3.04 3166
## treatmentInMGroupDHigh -0.93 0.07 -1.06 -0.80 2291
## treatmentInMGroupDLow -0.85 0.07 -0.97 -0.72 2621
## treatmentOutMGroupDHigh -0.80 0.06 -0.93 -0.68 2324
## treatmentOutMGroupDLow -1.11 0.08 -1.26 -0.97 2357
## log.followers -0.04 0.01 -0.07 -0.02 3720
## Rhat
## Intercept 1
## treatmentInMGroupDHigh 1
## treatmentInMGroupDLow 1
## treatmentOutMGroupDHigh 1
## treatmentOutMGroupDLow 1
## log.followers 1
##
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
## is a crude measure of effective sample size, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
summary(backwards_2m)
## Family: poisson (log)
## Formula: racism.counts.pre.2mon ~ treatment + log.followers
## Data: standard (Number of observations: 242)
## Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
## total post-warmup samples = 4000
## WAIC: Not computed
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Eff.Sample
## Intercept 2.89 0.07 2.75 3.04 3166
## treatmentInMGroupDHigh -0.93 0.07 -1.06 -0.80 2291
## treatmentInMGroupDLow -0.85 0.07 -0.97 -0.72 2621
## treatmentOutMGroupDHigh -0.80 0.06 -0.93 -0.68 2324
## treatmentOutMGroupDLow -1.11 0.08 -1.26 -0.97 2357
## log.followers -0.04 0.01 -0.07 -0.02 3720
## Rhat
## Intercept 1
## treatmentInMGroupDHigh 1
## treatmentInMGroupDLow 1
## treatmentOutMGroupDHigh 1
## treatmentOutMGroupDLow 1
## log.followers 1
##
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
## is a crude measure of effective sample size, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
marginal_effects(backwards_2m)
library(ggforce)
ggplot(aes(treatment, racism.counts.pre.2mon), data = standard) + geom_sina()
## Warning: Removed 1 rows containing non-finite values (stat_sina).
ggplot(aes(treatment, racism.counts.post.2mon), data = standard) + geom_sina() + scale_y_log10() + geom_pointrange(stat ="summary", fun.data = "mean_cl_boot")
## Warning: Transformation introduced infinite values in continuous y-axis
## Warning: Transformation introduced infinite values in continuous y-axis
## Warning: Removed 100 rows containing non-finite values (stat_sina).
## Warning: Removed 100 rows containing non-finite values (stat_summary).
ggplot(aes(treatment, racism.counts.pre.2mon), data = standard) + geom_sina() + geom_pointrange(stat ="summary", fun.data = "mean_cl_boot", color = "red")
## Warning: Removed 1 rows containing non-finite values (stat_sina).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
ggplot(aes(treatment, racism.counts.post.2mon), data = standard) + geom_sina() + geom_pointrange(stat ="summary", fun.data = "mean_cl_boot", color = "red")
ggplot(aes(racism.counts.pre.2mon, racism.counts.post.2mon), data = standard) + geom_jitter() + coord_cartesian(ylim = c(0,50), xlim = c(0, 50)) + geom_smooth(method = "lm")
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
ggplot(aes(racism.counts.pre.2mon, racism.counts.post.2mon, colour = treatment), data = standard) + geom_jitter() + coord_cartesian(ylim = c(0,50), xlim = c(0, 50)) + geom_smooth(method = "lm")
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
Are very active tweeters discouraged more/less?
(mon2_rac_interact_with_pre <- brm(racism.counts.post.2mon ~ racism.scores.pre.2mon * treatment + log.followers, data = standard, family = poisson))
## Warning: Rows containing NAs were excluded from the model
## Compiling the C++ model
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 1).
##
## Chain 1, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 1, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 1, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 1, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 1, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 1, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 1, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 1, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 1, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 1, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.385232 seconds (Warm-up)
## 0.299456 seconds (Sampling)
## 0.684688 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 2).
##
## Chain 2, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 2, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 2, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 2, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 2, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 2, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 2, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 2, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 2, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 2, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.335473 seconds (Warm-up)
## 0.21504 seconds (Sampling)
## 0.550513 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 3).
##
## Chain 3, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 3, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 3, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 3, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 3, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 3, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 3, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 3, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 3, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 3, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.413138 seconds (Warm-up)
## 0.262446 seconds (Sampling)
## 0.675584 seconds (Total)
##
##
## SAMPLING FOR MODEL 'poisson(log) brms-model' NOW (CHAIN 4).
##
## Chain 4, Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 4, Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 4, Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 4, Iteration: 600 / 2000 [ 30%] (Warmup)
## Chain 4, Iteration: 800 / 2000 [ 40%] (Warmup)
## Chain 4, Iteration: 1000 / 2000 [ 50%] (Warmup)
## Chain 4, Iteration: 1001 / 2000 [ 50%] (Sampling)
## Chain 4, Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 4, Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 4, Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4, Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4, Iteration: 2000 / 2000 [100%] (Sampling)
## Elapsed Time: 0.347137 seconds (Warm-up)
## 0.230239 seconds (Sampling)
## 0.577376 seconds (Total)
## Family: poisson (log)
## Formula: racism.counts.post.2mon ~ racism.scores.pre.2mon * treatment + log.followers
## Data: standard (Number of observations: 242)
## Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
## total post-warmup samples = 4000
## WAIC: Not computed
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI
## Intercept 1.65 0.10 1.45
## racism.scores.pre.2mon 0.94 0.04 0.86
## treatmentInMGroupDHigh -1.02 0.13 -1.28
## treatmentInMGroupDLow -0.43 0.10 -0.63
## treatmentOutMGroupDHigh -0.04 0.10 -0.24
## treatmentOutMGroupDLow -0.60 0.13 -0.85
## log.followers -0.02 0.01 -0.04
## racism.scores.pre.2mon:treatmentInMGroupDHigh 0.62 0.41 -0.26
## racism.scores.pre.2mon:treatmentInMGroupDLow 3.65 0.25 3.17
## racism.scores.pre.2mon:treatmentOutMGroupDHigh 2.49 0.29 1.93
## racism.scores.pre.2mon:treatmentOutMGroupDLow 4.27 0.72 2.85
## u-95% CI Eff.Sample Rhat
## Intercept 1.84 2764 1
## racism.scores.pre.2mon 1.02 2748 1
## treatmentInMGroupDHigh -0.77 2597 1
## treatmentInMGroupDLow -0.23 2392 1
## treatmentOutMGroupDHigh 0.15 2416 1
## treatmentOutMGroupDLow -0.36 2419 1
## log.followers 0.01 4000 1
## racism.scores.pre.2mon:treatmentInMGroupDHigh 1.39 2916 1
## racism.scores.pre.2mon:treatmentInMGroupDLow 4.14 2946 1
## racism.scores.pre.2mon:treatmentOutMGroupDHigh 3.06 3218 1
## racism.scores.pre.2mon:treatmentOutMGroupDLow 5.66 3029 1
##
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
## is a crude measure of effective sample size, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
summary(mon2_rac_interact_with_pre)
## Family: poisson (log)
## Formula: racism.counts.post.2mon ~ racism.scores.pre.2mon * treatment + log.followers
## Data: standard (Number of observations: 242)
## Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
## total post-warmup samples = 4000
## WAIC: Not computed
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI
## Intercept 1.65 0.10 1.45
## racism.scores.pre.2mon 0.94 0.04 0.86
## treatmentInMGroupDHigh -1.02 0.13 -1.28
## treatmentInMGroupDLow -0.43 0.10 -0.63
## treatmentOutMGroupDHigh -0.04 0.10 -0.24
## treatmentOutMGroupDLow -0.60 0.13 -0.85
## log.followers -0.02 0.01 -0.04
## racism.scores.pre.2mon:treatmentInMGroupDHigh 0.62 0.41 -0.26
## racism.scores.pre.2mon:treatmentInMGroupDLow 3.65 0.25 3.17
## racism.scores.pre.2mon:treatmentOutMGroupDHigh 2.49 0.29 1.93
## racism.scores.pre.2mon:treatmentOutMGroupDLow 4.27 0.72 2.85
## u-95% CI Eff.Sample Rhat
## Intercept 1.84 2764 1
## racism.scores.pre.2mon 1.02 2748 1
## treatmentInMGroupDHigh -0.77 2597 1
## treatmentInMGroupDLow -0.23 2392 1
## treatmentOutMGroupDHigh 0.15 2416 1
## treatmentOutMGroupDLow -0.36 2419 1
## log.followers 0.01 4000 1
## racism.scores.pre.2mon:treatmentInMGroupDHigh 1.39 2916 1
## racism.scores.pre.2mon:treatmentInMGroupDLow 4.14 2946 1
## racism.scores.pre.2mon:treatmentOutMGroupDHigh 3.06 3218 1
## racism.scores.pre.2mon:treatmentOutMGroupDLow 5.66 3029 1
##
## Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
## is a crude measure of effective sample size, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).